<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">
   课题3主要参与人员
    <security:authorize ifNotGranted="A_DAILU_PROPOSAL">
        <!-- <span style="font-size: 12px;font-weight: normal;">
        （如果您需要修改申请人信息， 请保存申请书后点击菜单“管理”>“个人信息维护”完成修改）
        </span> -->
    </security:authorize>
</div>
<table  id="zh_pers3" border="0" cellspacing="0" cellpadding="0" class="table01" style="table-layout: fixed; word-break: break-all; word-wrap: break-word" >
    <thead>
    <tr>
        <th width="5%" >选择</th>
        <th width="5%">序号</th>
        <th width="8%">姓名</th>
        <th width="10%">出生年月</th>
        <th width="5%">性别</th>
        <th width="10%">从事专业</th>
        <th width="10%">职称</th>
        <th width="10%">学历</th>
        <th width="15%">所在单位</th>
        <th width="10%">内设学院或机构（没有可填无）</th>
        <th width="12%" >项目分工 </th>
    </tr>
    </thead>
    <tbody id="tab">
    <tr style="display: none">
        <td  align="center"  width="50px" >
            <input type="radio" name="sel_zh_pers3" onclick="setSubmitPsn()" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|ethnicity_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|ethnicity_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|subject_code" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|subject_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|discipline_code" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|discipline_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|region_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|region_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|card_type_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|academician_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|academician_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|org_code" />
            <input type="hidden" name="zh_pers3|zh_person[0]|contact|tel_work" />
            <input type="hidden" name="zh_pers3|zh_person[0]|contact|fax" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|post_code" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_country_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_country_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_college" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|degree_year" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|address" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|prof_title" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|prof_title_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|gender" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|gender_value" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|post_doctor_value"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|post_doctor_name"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|birth_date"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|position"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|age"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|educate_value"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|iscomember" value="0"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|researches" label="xml"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|card_type_name" />
            <input type="hidden" name="zh_pers3|zh_person[0]|basic_info|card_code"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|contact|email"/>
            <input type="hidden" name="zh_pers3|zh_person[0]|contact|mobile"/>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]@seq_no">[index]</span>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]|basic_info|zh_name"></span>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]|basic_info|birthday"></span>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]|basic_info|gender_name"></span>
        </td>
        <td align="left">
            <span name="zh_pers3|zh_person[0]|contact|major_work"></span>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]|basic_info|prof_title_name"></span>
        </td>
        <td align="center">
            <span name="zh_pers3|zh_person[0]|basic_info|educate_name"></span>
        </td>
        <td align="left">
            <span  name="zh_pers3|zh_person[0]|basic_info|org_name" ></span>
        </td>
        <td align="left">
            <span id="built_institute_[0]" name="zh_pers3|zh_person[0]|contact|built_institute"></span>
        </td>
        <td align="left">
            <span name="zh_pers3|zh_person[0]|basic_info|work" ></span>
        </td>
    </tr>
    <c:set value="0" var="index" scope="page" />
    <x:forEach select="$xmlData/data/zh_pers3/zh_person" var="zh_person">
        <c:choose>
            <c:when test="${index<10}">
                <c:set value="0" var="flag" scope="page" />
            </c:when>
            <c:otherwise>
                <c:set value="" var="flag" scope="page" />
            </c:otherwise>
        </c:choose>
        <tr>
            <td  align="center"  width="50px" >
                <input type="radio" name="sel_zh_pers3" onclick="setSubmitPsn3()" />
                <c:if test="${index==0}">
                    <input type="hidden" id="submit_psn" name="zh_pers3/zh_person[${flag}${index}]@submit_psn" value="1" />
                    <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/psn_code" value="<x:out select="$zh_person/basic_info/psn_code" />"/>
                </c:if>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/en_name" value="<x:out select="$zh_person/basic_info/en_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/ethnicity_value" value="<x:out select="$zh_person/basic_info/ethnicity_value" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/ethnicity_name" value="<x:out select="$zh_person/basic_info/ethnicity_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/subject_code" value="<x:out select="$zh_person/basic_info/subject_code" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/subject_name" value="<x:out select="$zh_person/basic_info/subject_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/discipline_code" value="<x:out select="$zh_person/basic_info/discipline_code" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/discipline_name" value="<x:out select="$zh_person/basic_info/discipline_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/region_value" value="<x:out select="$zh_person/basic_info/region_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/region_name" value="<x:out select="$zh_person/basic_info/region_name" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/card_type_value" value="<x:out select="$zh_person/basic_info/card_type_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/academician_value" value="<x:out select="$zh_person/basic_info/academician_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/academician_name" value="<x:out select="$zh_person/basic_info/academician_name" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/org_code" value="<x:out select="$zh_person/basic_info/org_code" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/contact/tel_work" value="<x:out select="$zh_person/contact/tel_work" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/contact/fax" value="<x:out select="$zh_person/contact/fax" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_value" value="<x:out select="$zh_person/basic_info/degree_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_name" value="<x:out select="$zh_person/basic_info/degree_name" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/post_code" value="<x:out select="$zh_person/basic_info/post_code" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_country_value" value="<x:out select="$zh_person/basic_info/degree_country_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_country_name" value="<x:out select="$zh_person/basic_info/degree_country_name" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_college" value="<x:out select="$zh_person/basic_info/degree_college" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/degree_year" value="<x:out select="$zh_person/basic_info/degree_year" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/position" value="<x:out select="$zh_person/basic_info/position" />" />

                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/gender" value="<x:out select="$zh_person/basic_info/gender" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/gender_value" value="<x:out select="$zh_person/basic_info/gender_value" />" />

                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/prof_title" value="<x:out select="$zh_person/basic_info/prof_title" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/prof_title_value" value="<x:out select="$zh_person/basic_info/prof_title_value" />" />
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/address" value="<x:out select="$zh_person/basic_info/address" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/post_doctor_value" value="<x:out select="$zh_person/basic_info/post_doctor_value" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/post_doctor_name" value="<x:out select="$zh_person/basic_info/post_doctor_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/age" value="<x:out select="$zh_person/basic_info/age" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/educate_value" value="<x:out select="$zh_person/basic_info/educate_value" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/card_code" value="<x:out select="$zh_person/basic_info/card_code" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/basic_info/card_type_name" value="<x:out select="$zh_person/basic_info/card_type_name" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/contact/email" value="<x:out select="$zh_person/contact/email" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/contact/mobile" value="<x:out select="$zh_person/contact/mobile" />"/>
                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/iscomember" value="0"/>

                <input type="hidden" name="zh_pers3/zh_person[${flag}${index}]/researches" label="xml"/>
            </td>
            <td align="center">
                <span name="zh_pers3/zh_person[${flag}${index}]@seq_no">${index+1}</span>
            </td>
            <td align="center">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/zh_name"><x:out select="$zh_person/basic_info/zh_name" /></span>
                <security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
                    <c:if test="${index==0 }"><a href="###" class="Blue" style="text-decoration: none;" onclick="selectFirstRadio(this);editRow('zh_pers3','${ctx}/proposal/edit/dialog/psnInfoEdit_dwkjhz?parentTab=zh_pers3&type=edit&needMeetingInfo=${param.needMeetingInfo}&psnCode=<x:out select="$zh_person/basic_info/psn_code" />&TB_iframe=true&height=440&width=900','编辑项目参与人信息')">[&nbsp;设置&nbsp;]</a></c:if>
                </security:authorize>
            </td>
            <td align="center">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/birthday"><x:out select="$zh_person/basic_info/birthday" /></span>
            </td>
            <td align="center">
                <c:set var="gender_value"><x:out select="$zh_person/basic_info/gender_value" /></c:set>
                <c:choose>
                    <c:when test="${gender_value == 'F' || gender_value == 'M'}">
                        <c:if test="${gender_value == 'F'}">女</c:if>
                        <c:if test="${gender_value == 'M'}">男</c:if>
                    </c:when>
                    <%-- <c:otherwise>
                         <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/gender_name"><x:out select="$zh_person/basic_info/gender_name" /></span>
                     </c:otherwise> --%>
                </c:choose>
            </td>

                <%-- <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/gender_name"><x:out select="$zh_person/basic_info/gender_name" /></span> --%>
            <td align="left">
                <span name="zh_pers3/zh_person[${flag}${index}]/contact/major_work"><x:out select="$zh_person/contact/major_work" /></span>
            </td>
            <td align="center">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/prof_title_name"><x:out select="$zh_person/basic_info/prof_title_name" /></span>
            </td>
            <td align="center">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/educate_name"><x:out select="$zh_person/basic_info/educate_name" /></span>
            </td>
            <td align="left">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/org_name"><x:out select="$zh_person/basic_info/org_name" /></span>
            </td>
            <td align="left">
                <span name="zh_pers3/zh_person[${flag}${index}]/contact/built_institute" id="built_institute_[${flag}${index}]"><x:out select="$zh_person/contact/built_institute" /></span>
            </td>
            <td align="left">
                <span name="zh_pers3/zh_person[${flag}${index}]/basic_info/work"><x:out select="$zh_person/basic_info/work" /></span>
            </td>
        </tr>
        <c:set value="${index+1}" var="index" scope="page" />
    </x:forEach>
    </tbody>
</table>

<table border="0" cellpadding="0" cellspacing="1">
    <tr>
        <td>
            <input class="button_02" type="button" value="添加"
                   onclick="if(checkTabLimit('zh_pers3',6,'各课题人员不超过6名')){addNewRow('zh_pers3','${ctx}/proposal/edit/dialog/psnInfoEdit_zyy3?parentTab=zh_pers3&type=add&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=900','添加项目参与人');}try{top.resizeFrame();}catch(e){};">
            &nbsp;<input class="button_02"  id="zh_psnPrev" type="button" value="上移" onclick="if(getSelecedIndex3()!=2){movePrev('zh_pers3');setSubmitPsn3();}">
            &nbsp;<input class="button_02"  id="zh_psnNext" type="button" value="下移" onclick="if(getSelecedIndex3()!=1){moveNext('zh_pers3');setSubmitPsn3();}">
            &nbsp;<input class="button_02"  id="zh_psnEdit" type="button" value="编辑" onclick="editRow('zh_pers3','${ctx}/proposal/edit/dialog/psnInfoEdit_zyy3?parentTab=zh_pers3&type=edit&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=900','编辑项目参与人信息')">
            &nbsp;<input class="button_02"  id="zh_psnDel" type="button" value="删除" onclick="deleteSelectedRow('zh_pers3','人员信息',0,'申请人不能被删除');setFirstWork3();"></td>
    </tr>
    </tbody>
    <tfoot>
    </tfoot>
</table>


<script type="text/javascript">
    function getSelecedIndex3()
    {
        var index= $('#zh_pers3 [name="sel_zh_pers3"]').index($('#zh_pers3 [name="sel_zh_pers3"]:checked'));
        return index;
    }
    function setFirstWork3()
    {
        $('#zh_pers3 [name$="basic_info/work"]:eq(0)').html("课题主持人");
    }
    function selectFirstRadio(obj) {
        $(obj).parent('td').parent('tr').find('input[type="radio"]').attr("checked","checked");
        setSubmitPsn3();
    }
    function checkSubmitPsn(tableId){
        <security:authorize ifNotGranted="A_DAILU_PROPOSAL">
        var tr=$("#"+tableId+" :radio:checked").parents("tr");
        if(tr.length!=0 && tr.get(0).rowIndex==2){
            scmWarn('如果您需要修改申请人信息， 请保存申请书后点击菜单“系统管理”>“个人信息维护”完成修改');
            return false;
        }
        </security:authorize>

        return true;

    }
    function psnSynchro(){
        $("span[name$='fzr_psnname']").text($("#zh_pers3 tr:eq(2)").find("span[name$='basic_info/zh_name']").text());
        $("span[name$='fzr_tel']").text($("#zh_pers3 tr:eq(2)").find("input[name$='contact/tel_work']").val());
        $("span[name$='fzr_mobile']").text($("#zh_pers3 tr:eq(2)").find("input[name$='contact/mobile']").val());
        $("span[name$='fzr_mail']").text($("#zh_pers3 tr:eq(2)").find("input[name$='contact/email']").val());
    }

    /**
     * 锁定申报人行的按钮
     */
    function setSubmitPsn3() {
        if($("#zh_pers3 :radio:checked").length==0){
            scmWarn('请选择一行!');
            return false;
        }
        var tr = $("#zh_pers3 :radio:checked").parents("tr");
        if (tr.get(0).rowIndex - 1 == 1) {// 如果选择的是申报人
            $("#zh_psnPrev").attr("disabled", "true").css("color", "#808080");
            $("#zh_psnNext").attr("disabled", "true").css("color", "#808080");
            // $("#zh_psnEdit").attr("disabled","true").css("color","#808080");
            $("#zh_psnDel").attr("disabled", "true").css("color", "#808080");

        } else if (tr.get(0).rowIndex - 1 == 2) {// 如果是申报书的下一行
            $("#zh_psnPrev").attr("disabled", "true").css("color", "#808080");
            $("#zh_psnNext").removeAttr("disabled").css("color", "#003366");
            $("#zh_psnDel").removeAttr("disabled").css("color", "#003366");
        } else {
            $("#zh_psnPrev").removeAttr("disabled").css("color", "#003366");
            $("#zh_psnNext").removeAttr("disabled").css("color", "#003366");
            // $("#zh_psnEdit").removeAttr("disabled").css("color","#003366");
            $("#zh_psnDel").removeAttr("disabled").css("color", "#003366");
        }

    }
</script>